% Author: Yang Ge, geyang_xjnu@sina.com
% 
% calculate the amplitude of ith fire work 
function result = calculate_amplitude(seeds_fitness, ith)
global coef_amplitude;

total = 0;
seeds_amount = length(seeds_fitness);
best_fitness = min(seeds_fitness);
ith2best = seeds_fitness(ith) - best_fitness + eps;

for n = 1:seeds_amount
    total = total + (seeds_fitness(n) - best_fitness);
end

% obtain the amplitude of ith fire work
amplitude_of_ith = coef_amplitude * ith2best / (total + eps);

result = amplitude_of_ith;

end